import { defineConfig, loadEnv } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'

export default defineConfig(({ mode, command }) => {
    return {
        base: '/',
        build: {
            minify: true,
            outDir: 'dist',
        },
        plugins: [
            uni()
        ],
        // vite 相关配置
        server: {
            port: 8083,
            host: true,
            // open: true,
            proxy: {
                '/dev-api': {
                    // target: 'http://192.168.2.11:8080/', //倪
                    // target: 'http://47.122.29.220:8080/', //邓
                    // target: 'http://http://47.122.29.220/', //邓
                    // target: 'http://121.40.196.239:8080/', //服务器
                    target: 'http://192.168.2.9:8082', //内网服务
                    headers: { Host: '127.0.0.1:8098' }, //8097 8098
                    changeOrigin: true,
                    rewrite: (p) => p.replace(/^\/dev-api/, '')
                }
            }
        },
        exclude: [
            /\/README\.md$/,
        ]
    }
})